local animation_icons = {}
for a=1,200 do
    local icon = class.panel.create('',0,0,5,5)
    icon:set_level(9)
    icon:hide()
    animation_icons[a] = icon
end


ac.game:event '动画-播放拖动'(function(_,art,tween)
    local subject = tween.subject
    local icon = table.remove(animation_icons,1)
    icon.tween = tween
    icon:set_normal_image(art)
    icon:set_position(subject.x,subject.y)
    icon:set_control_size(subject.w,subject.h)
    table.insert(animation_icons,icon)
end)





ac.hardware:on("界面绘制")(function(_,delta)
    for i,icon in ipairs(animation_icons) do
        local tween = icon.tween
        if icon:is_show() and tween and tween.clock >= tween.duration then
            local subject = tween.subject
            tween:set(self.clock + delta)
            icon:set_position(subject.x,subject.y)
            icon:set_control_size(subject.w,subject.h)
            icon:show()
        else
            icon:hide()
        end
        
    end
end)
